From: Keir Fraser Date: Mon, 12 Apr 2010 06:22:16 +0000 (+0100) Subject: libxc: Flush I/O before xc_domain_save completion X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12414 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=560f4dc7f29e3c5f79728bc01b2dd4828e55b673;p=xen.git libxc: Flush I/O before xc_domain_save completion The final, flushing call to discard_file_cache also discards any errors from fsync. Call fsync explicitly before leaving, to check if all VM memory actually made it to the disk. Signed-off-by: Daniel Stodden --- diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 2334b49c07..cb98374e02 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1764,6 +1764,13 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, goto out; } + /* Flush last write and check for errors. */ + if ( fsync(io_fd) && errno != EINVAL ) + { + PERROR("Error when flushing state file"); + goto out; + } + /* Success! */ rc = 0;